<%@ page import="java.util.List" %>
<%@ page import="com.heima.jopo.obj.UserInfo" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-3.6.0.js"></script>
    <style type="text/css">
        html {
            height: 100%;
            width: 100%;
            overflow: hidden;
            margin: 0;
            padding: 0;
            background: url("imgage/996.jpg") no-repeat 0px 0px;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            -moz-background-size: 100% 100%;
        }
    </style>
    <script>
        $(function () {
            $(".delet").click(function () {

                let b = window.confirm("确定删除？");
                var id = $(this).closest("tr");
                let id1 = id.find("td:eq(0)").html();

                $("#id").val(id1);
                if (b == false) {
                    return;
                }
                $("#niubi").submit();

            })


            $(".updeteinfo").click(function () {

                var id = $(this).closest("tr");
                let id1 = id.find("td:eq(0)").html();
                    //获得当前行 赋值給修改的隐藏文本框
                $("#upid").val(id1);
                $("#update").submit();
            })


            $("#exit").click(function (){

                window.location.href="exit";

            })

        })
    </script>
</head>
<body >
<table border="1" align="center">
    <h3 align="center0">欢迎登录</h3>   <a style="color: aquamarine" id="exit">退出登录</a>
    <tr>
        <th>ID</th>
        <th>账户</th>
        <th>密码</th>
        <th>姓名</th>
        <th>性别</th>
        <th>生日</th>
        <th>职业</th>
        <th></th>
    </tr>


    <c:forEach var="list" items="${seleUser}">
        <tr>
            <td><c:out value="${list.id}"></c:out></td>  <!-- JStl代码写法 -->
            <td>${list.phone}</td>
            <td>${list.passwrod}</td>
            <td>${list.username}</td>
            <td>${list.sex}</td>
            <td>${list.birthday}</td>
            <td>${list.career}</td>
            <td><input type="button" value="删除" class="delet">&nbsp;&nbsp;
                <input type="button" value="编辑" class="updeteinfo"></td>
        </tr>

    </c:forEach>
</table>
<form action="dlet" method="post" id="niubi">
    <input type="hidden" value="" name="id" id="id">
</form>
<!-- 跳转页面的form表单  和修改的ID-->
<form action="update" method="post" id="update">
    <input type="hidden" value="" name="uid" id="upid">
</form>
</body>
</html>
